﻿#include "xpushbuttonfourarithmetic_p.h"

XPushButtonFourArithmeticPrivate::XPushButtonFourArithmeticPrivate()
    : resultRegister(nullptr),
      arithmeticType(Addition),
      leftOperandNumberType(Constant),
      rightOperandNumberType(Constant),
      leftOperandRegister(nullptr),
      rightOperandRegister(nullptr),
      leftOperandConstant(0),
      rightOperandConstant(0),
      upperLimitEnable(false),
      lowerLimitEnable(false),
      upperLimitType(Constant),
      lowerLimitType(Constant),
      upperLimitRegister(nullptr),
      lowerLimitRegister(nullptr),
      upperLimitConstant(100),
      lowerLimitConstant(0)
{

}

XPushButtonFourArithmeticPrivate::~XPushButtonFourArithmeticPrivate()
{

}

XPushButtonFourArithmetic::XPushButtonFourArithmetic(QWidget *parent)
    : QObject(parent),
      xPushButtonFourArithmeticP(new XPushButtonFourArithmeticPrivate)
{

}

XPushButtonFourArithmetic::~XPushButtonFourArithmetic()
{
    delete xPushButtonFourArithmeticP;
}


/*!
    \property XPushButtonFourArithmetic::resultRegister
    \brief the register to store result

    The default resultRegister is nullptr.

    \sa indent
*/
XRegister *XPushButtonFourArithmetic::getResultRegister() const
{
    return xPushButtonFourArithmeticP->resultRegister;
}

void XPushButtonFourArithmetic::setResultRegister(XRegister *resultRegis)
{
    xPushButtonFourArithmeticP->resultRegister = resultRegis;
}

/*!
    \property XPushButtonFourArithmetic::arithmeticType
    \brief the type of the arithmetic

    The arithmetic is the funtion of XPushButtonFourArithmetic.

    The default arithmetic is Addition.

    \sa indent
*/
FourArithmeticType XPushButtonFourArithmetic::getArithmeticType() const
{
    return xPushButtonFourArithmeticP->arithmeticType;
}

void XPushButtonFourArithmetic::setArithmeticType(FourArithmeticType type)
{
    if(xPushButtonFourArithmeticP->arithmeticType == type)
        return;
    xPushButtonFourArithmeticP->arithmeticType = type;
}

/*!
    \property XPushButtonFourArithmetic::leftOperandNumberType
    \brief the type of the leftOperandNumber

    The default leftOperandNumberType is Constant.

    \sa indent
*/
NumberType XPushButtonFourArithmetic::getLeftOperandNumberType() const
{
    return xPushButtonFourArithmeticP->leftOperandNumberType;
}

void XPushButtonFourArithmetic::setLeftOperandNumberType(NumberType type)
{
    if(xPushButtonFourArithmeticP->leftOperandNumberType == type)
        return;
    xPushButtonFourArithmeticP->leftOperandNumberType = type;
}

/*!
    \property XPushButtonFourArithmetic::rightOperandNumberType
    \brief the type of the rightOperandNumber

    The default rightOperandNumberType is Constant.

    \sa indent
*/
NumberType XPushButtonFourArithmetic::getRightOperandNumberType() const
{
    return xPushButtonFourArithmeticP->rightOperandNumberType;
}

void XPushButtonFourArithmetic::setRightOperandNumberType(NumberType type)
{
    if(xPushButtonFourArithmeticP->rightOperandNumberType == type)
        return;
    xPushButtonFourArithmeticP->rightOperandNumberType = type;
}

/*!
    \property XPushButtonFourArithmetic::leftOperandRegister
    \brief the register acts as a left operand

    The default leftOperandRegister is nullptr.

    \sa indent
*/
XRegister *XPushButtonFourArithmetic::getLeftOperandRegister() const
{
    return xPushButtonFourArithmeticP->leftOperandRegister;
}

void XPushButtonFourArithmetic::setLeftOperandRegister(XRegister *leftOperandRegis)
{
    if(Constant == xPushButtonFourArithmeticP->leftOperandNumberType)
        return;
    xPushButtonFourArithmeticP->leftOperandRegister = leftOperandRegis;
}

/*!
    \property XPushButtonFourArithmetic::rightOperandRegister
    \brief the register acts as a right operand

    The default rightOperandRegister is nullptr.

    \sa indent
*/
XRegister *XPushButtonFourArithmetic::getRightOperandRegister() const
{
    return xPushButtonFourArithmeticP->leftOperandRegister;
}

void XPushButtonFourArithmetic::setRightOperandRegister(XRegister *leftOperandRegis)
{
    if(Constant == xPushButtonFourArithmeticP->rightOperandNumberType)
        return;
    xPushButtonFourArithmeticP->leftOperandRegister = leftOperandRegis;
}

/*!
    \property XPushButtonFourArithmetic::leftOperandConstant
    \brief the constant acts as a left operand

    The default leftOperandConstant is 0.

    \sa indent
*/
double XPushButtonFourArithmetic::getLeftOperandConstant() const
{
    return xPushButtonFourArithmeticP->leftOperandConstant;
}

void XPushButtonFourArithmetic::setLeftOperandConstant(double value)
{
    if(Variable == xPushButtonFourArithmeticP->leftOperandNumberType)
        return;
    if(xPushButtonFourArithmeticP->leftOperandConstant == value)
        return;
    xPushButtonFourArithmeticP->leftOperandConstant = value;
}

/*!
    \property XPushButtonFourArithmetic::rightOperandConstant
    \brief the constant acts as a left operand

    The default rightOperandConstant is 0.

    \sa indent
*/
double XPushButtonFourArithmetic::getRightOperandConstant() const
{
    return xPushButtonFourArithmeticP->rightOperandConstant;
}

void XPushButtonFourArithmetic::setRightOperandConstant(double value)
{
    if(Variable == xPushButtonFourArithmeticP->rightOperandNumberType)
        return;
    if(xPushButtonFourArithmeticP->rightOperandConstant == value)
        return;
    xPushButtonFourArithmeticP->rightOperandConstant = value;
}

/*!
    \property XPushButtonFourArithmetic::upperLimitEnable
    \brief whether or not use upper limit

    The default upperLimitEnable is false.

    \sa indent
*/
bool XPushButtonFourArithmetic::getUpperLimitEnable() const
{
    return xPushButtonFourArithmeticP->upperLimitEnable;
}

void XPushButtonFourArithmetic::setUpperLimitEnable(bool enable)
{
    if(xPushButtonFourArithmeticP->upperLimitEnable == enable)
        return;
    xPushButtonFourArithmeticP->upperLimitEnable = enable;
}

/*!
    \property XPushButtonFourArithmetic::lowerLimitEnable
    \brief whether or not use lower limit

    The default lowerLimitEnable is false.

    \sa indent
*/
bool XPushButtonFourArithmetic::getLowerLimitEnable() const
{
    return xPushButtonFourArithmeticP->lowerLimitEnable;
}

void XPushButtonFourArithmetic::setLowerLimitEnable(bool enable)
{
    if(xPushButtonFourArithmeticP->lowerLimitEnable == enable)
        return;
    xPushButtonFourArithmeticP->lowerLimitEnable = enable;
}

/*!
    \property XPushButtonFourArithmetic::upperLimitType
    \brief the type of the upperLimit

    The default upperLimitType is Constant.

    \sa indent
*/
NumberType XPushButtonFourArithmetic::getUpperLimitType() const
{
    return xPushButtonFourArithmeticP->upperLimitType;
}

void XPushButtonFourArithmetic::setUpperLimitType(NumberType type)
{
    if(!xPushButtonFourArithmeticP->upperLimitEnable)
        return;
    if(xPushButtonFourArithmeticP->upperLimitType == type)
        return;
    xPushButtonFourArithmeticP->upperLimitType = type;
}

/*!
    \property XPushButtonFourArithmetic::lowerLimitType
    \brief the type of the lowerLimit

    The default lowerLimitType is Constant.

    \sa indent
*/
NumberType XPushButtonFourArithmetic::getLowerLimitType() const
{
    return xPushButtonFourArithmeticP->lowerLimitType;
}

void XPushButtonFourArithmetic::setLowerLimitType(NumberType type)
{
    if(!xPushButtonFourArithmeticP->lowerLimitEnable)
        return;
    if(xPushButtonFourArithmeticP->lowerLimitType == type)
        return;
    xPushButtonFourArithmeticP->lowerLimitType = type;
}

/*!
    \property XPushButtonFourArithmetic::upperLimitRegister
    \brief the register acts as a upper Limit

    The default upperLimitRegister is nullptr.

    \sa indent
*/
XRegister *XPushButtonFourArithmetic::getUpperLimitRegister() const
{
    return xPushButtonFourArithmeticP->upperLimitRegister;
}

void XPushButtonFourArithmetic::setUpperLimitRegister(XRegister *upperLimitRegis)
{
    if(!xPushButtonFourArithmeticP->upperLimitEnable)
        return;
    xPushButtonFourArithmeticP->upperLimitRegister = upperLimitRegis;
}

/*!
    \property XPushButtonFourArithmetic::lowerLimitRegister
    \brief the register acts as a lower Limit

    The default lowerLimitRegister is nullptr.

    \sa indent
*/
XRegister *XPushButtonFourArithmetic::getLowerLimitRegister() const
{
    return xPushButtonFourArithmeticP->lowerLimitRegister;
}

void XPushButtonFourArithmetic::setLowerLimitRegister(XRegister *upperLimitRegis)
{
    if(!xPushButtonFourArithmeticP->lowerLimitEnable)
        return;
    xPushButtonFourArithmeticP->lowerLimitRegister = upperLimitRegis;
}

/*!
    \property XPushButtonFourArithmetic::upperLimitConstant
    \brief the constant acts as a upper operand

    The default upperLimitConstant is 0.

    \sa indent
*/
int XPushButtonFourArithmetic::getUpperLimitConstant() const
{
    return xPushButtonFourArithmeticP->upperLimitConstant;
}

void XPushButtonFourArithmetic::setUpperLimitConstant(int value)
{
    if(!xPushButtonFourArithmeticP->upperLimitEnable)
        return;
    if(xPushButtonFourArithmeticP->upperLimitConstant == value)
        return;
    xPushButtonFourArithmeticP->upperLimitConstant = value;
}

/*!
    \property XPushButtonFourArithmetic::lowerLimitConstant
    \brief the constant acts as a lower operand

    The default lowerLimitConstant is 0.

    \sa indent
*/
int XPushButtonFourArithmetic::getLowerLimitConstant() const
{
    return xPushButtonFourArithmeticP->lowerLimitConstant;
}

void XPushButtonFourArithmetic::setLowerLimitConstant(int value)
{
    if(!xPushButtonFourArithmeticP->lowerLimitEnable)
        return;
    if(xPushButtonFourArithmeticP->lowerLimitConstant == value)
        return;
    xPushButtonFourArithmeticP->lowerLimitConstant = value;
}

